<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/expand/css/style.css?v=${constants.getReleaseVersion()}" media="all"/>
    <link rel="stylesheet" href="/assets/common/module/formSelects/formSelects-v4.css">
</head>
<br>
用来测试的页面

数量是 ：${userId}
日程框架是：</br>
${scheduleFrames}
</br>

</br></br></br>



<form action="" method="post">
    <!--属性有ID，日程名称，组织，共享ID（用于生成共享链接），创建的日 期，创建用户ID，开始日期，结束日期，周数量-->
    日程框架名称<input type="text" name="sframe_name" id="" value="" />
    组织<input type="text" name="organization" id="organization" value="" />
    开始日期<input type="date" name="start_time" id="start_time" value="" />
    <input type="submit" value="保存未用"/>
    <input type="button" id="addSformItem" value="添加日程项"/>
    <input type="button" id="copySframeBtn" value="复制日程框架表"/>
    <input type="button" id="reviseSformBtn" value="修改日程表"/>
    <input type="button" id="combineSformBtn" value="合并日程表"/>
    <input type="button" id="deleteSformBtn" value="删除日程表"/>
    <input type="button" id="deleteSframeBtn" value="删除日程框架"/>
    <input type="button" id="showSformBtn" value="查看日程表"/>
    <input type="button" id="checkScheduleFormBtn" value="查看日程表信息"/>
    <input type="button" id="saveSformItem" value="保存日程项"/>

    <input type="button" id="reviseSframeBtn" value="修改日程框架"/>


    <label class="layui-form-label">是否共享</label>
    <div class="layui-input-inline">
        <input type="checkbox" name="share" lay-skin="switch" lay-filter="shareSwitch"  value="ON" lay-text="ON|OFF" >
    </div>
</form>

${scheduleForms}
</br></br></br>
${scheduleForm}
</br></br></br>
${scheduleFrame}



<!-- js部分 -->
@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>

<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script>
layui.use(['layer', 'carousel','form'], function () {
var $ = layui.jquery;
var layer = layui.layer;
var carousel = layui.carousel;
var device = layui.device;
var form = layui.form;
var buttomId = "全局变量";

/**
* 系统管理--用户管理
*/
var MgrUser = {
tableId: "userTable",    //表格id
condition: {
name: "",
deptId: "",
timeLimit: ""
}
};



$(function () {

    //查看日程表
    $("#addSformItem").click(function () {
        window.location.href="/myScheduleForm/checkScheduleForm2?sformId=1";
    });


//查看日程表(插件)
           $("#checkScheduleFormBtn").click(function () {
        window.location.href="/myScheduleForm/checkScheduleForm?sformId=1";

});

    //添加日程项
    $('#saveSformItem').on('click', function(){
        layer.open({
            type:2,
            area: ['800px', '400px'],
            title: '添加日程项',
            content: Feng.ctxPath + '/myScheduleFormItem/createSformItem?sformId=1&serial=1&sformItemDate=2019-12-11 00:00:00&startTime=2019-12-11 00:00:00&stopTime=2019-12-11 00:00:00',
            tableId: MgrUser.tableId
        });
    });


//复制日程框架
    $('#copySframeBtn').on('click', function(){
        layer.open({
        type:2,
        area: ['500px', '300px'],
        title: '复制日程框架',
        content: Feng.ctxPath + '/myScheduleFrame/loadCopySframe?sframeId=27',
        tableId: MgrUser.tableId
        });
    });



    $('#showSformBtn').on('click',function () {
        window.location.href='/myScheduleForm/showform';
    });


    //修改日程框架
    $('#reviseSframeBtn').on('click', function(){
        layer.open({
            type:2,
            area: ['800px', '600px'],
            title: '修改日程框架',
            content: Feng.ctxPath + '/myScheduleFrame/reviseSframe?sframeId=1',

            tableId: MgrUser.tableId
        });
    });



    //修改日程表
    $('#reviseSformBtn').on('click', function(){
        layer.open({
            type:2,
            area: ['800px', '400px'],
            title: '修改日程',
            content: Feng.ctxPath + '/myScheduleForm/reviseSform',

            tableId: MgrUser.tableId
        });
    });

    //合并日程表
    $('#combineSformBtn').on('click', function(){
        alert("graeh")
        layer.open({
            type:2,
            area: ['600px', '500px'],
            title: '合并日程',
            content: Feng.ctxPath + '/myScheduleForm/loadcombineSform?sformId=1',
            tableId: MgrUser.tableId
        });
    });
    form.render();

    //监听是否为分享开关
    form.on('switch(shareSwitch)', function(data){
        alert(data.othis);
        $.post({
            url:"/myScheduleForm/setShare?sformId=13",
            data:data.othis,
            success:function (data) {
                console.log(data);
                if (data.valueOf()=='修改成功！') {
                                               Feng.success("该日程表设置成功！");
                                               /* //关闭当前窗口
                                                admin.closeThisDialog();*/
                    //parent.location.href="/myScheduleForm/showScheduleForm";

                }else {
                    Feng.error(data.valueOf());
                }
            }
        });

        /* layer.tips('该日程表是共享状态', data.othis)*/
    });

    //删除
    $('#deleteSformBtn').on('click', function(){
        alert("graeh")
        layer.confirm('您是确定要删除该日程表吗？', {
            btn: ['确定','取消'] //按钮
        },
            function(){
                $.post({
                    url:"/myScheduleForm/deleteSformBySformId?sformId=11",
                    success:function (data) {
                        console.log(data);
                        if (data.valueOf()=='删除日程表成功！') {
                            Feng.success(data.valueOf());
/*                            //关闭当前窗口
                            admin.closeThisDialog();*/
                            window.location.href="/myScheduleForm/showScheduleForm";

                        }else {
                            Feng.error(data.valueOf());
                        }
                    }
                });

        });
    });


    //删除日程框架
    $('#deleteSframeBtn').on('click', function(){
        alert("graeh")
        layer.confirm('您是否确定要删除该日程框架及框架项？', {
                btn: ['确定','取消'] //按钮
            },
            function(){
                $.post({
                    url:"/myScheduleFrame/deleteSframeBySframeId",
                    data:{'sframeId':'16'},
                    success:function (data) {
                        console.log(data);
                        if (data.valueOf()=='日程框架删除成功！') {
                            Feng.success(data.valueOf());
/*                            //关闭当前窗口
                            admin.closeThisDialog();*/
                            window.location.href="/myScheduleFrame/showMyScheduleFrame";
                        }else {
                            Feng.error(data.valueOf());
                        }
                    }
                });



            });
    });






});



});

</script>

</body>
</html>